//
//  HeaderOfClickYongHu.m
//  SeeTheWorld
//
//  Created by dllo on 16/3/1.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "HeaderOfClickYongHu.h"
#import "PCH.pch"
#import "ModelOfClickYongHuHeader.h"
#import <UIImageView+WebCache.h>


@interface HeaderOfClickYongHu ()

@property (nonatomic, retain)UIImageView *imageOfTouXiang;
@property (nonatomic, retain)UILabel *labelOfName;
@property (nonatomic, retain)UILabel *labelOfCount;
@property (nonatomic, retain)UILabel *labelOfGuanZhu;
@property (nonatomic, retain)UILabel *labelOfSiXin;

@end

@implementation HeaderOfClickYongHu

- (void)dealloc {
    [_imageOfTouXiang release];
    [_labelOfCount release];
    [_labelOfGuanZhu release];
    [_labelOfName release];
    [_labelOfSiXin release];
    [super dealloc];
}

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.dk_backgroundColorPicker = DKColorWithRGB(0xffffff, 0x343434);

        
        self.imageOfTouXiang = [[UIImageView alloc] init];
        [self.contentView addSubview:self.imageOfTouXiang];
        [_imageOfTouXiang release];
       
        self.labelOfName = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelOfName];
        [_labelOfName release];
        self.labelOfName.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);

        self.labelOfCount = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelOfCount];
        [_labelOfCount release];
        self.labelOfCount.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);
        
        self.labelOfGuanZhu = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelOfGuanZhu];
        [_labelOfGuanZhu release];
        self.labelOfGuanZhu.textAlignment = 1;
        self.labelOfGuanZhu.layer.borderWidth = 1;
        self.labelOfGuanZhu.layer.borderColor = [[UIColor grayColor] CGColor];
        self.labelOfGuanZhu.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);

        self.labelOfSiXin = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelOfSiXin];
        [_labelOfSiXin release];
        self.labelOfSiXin.textAlignment = 1;
        self.labelOfSiXin.layer.borderWidth = 1;
        self.labelOfSiXin.layer.borderColor = [[UIColor grayColor] CGColor];
        self.labelOfSiXin.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);

    }
    
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.imageOfTouXiang.frame = CGRectMake(10, 10, self.contentView.frame.size.width / 4, self.contentView.frame.size.width / 4);
    self.imageOfTouXiang.layer.cornerRadius = self.contentView.frame.size.width / 4 / 2;
    self.imageOfTouXiang.layer.masksToBounds = YES;
    
    self.labelOfName.frame = CGRectMake(10 + self.contentView.frame.size.width / 4 + 10, 20, self.contentView.frame.size.width / 4 * 3 - 30, 35);
    
    self.labelOfCount.frame = CGRectMake(10 + self.contentView.frame.size.width / 4 + 10, 20 + 35 + 10, self.contentView.frame.size.width / 4 * 3 - 30, 35);
    
    self.labelOfGuanZhu.frame = CGRectMake(10, 10 + self.contentView.frame.size.width / 4 + 10, (self.contentView.frame.size.width - 30) / 2, 30);
    
    self.labelOfSiXin.frame = CGRectMake(20 + (self.contentView.frame.size.width - 30) / 2, 10 + self.contentView.frame.size.width / 4 + 10, (self.contentView.frame.size.width - 30) / 2, 30);
}

- (void)passModel:(ModelOfClickYongHuHeader *)model {
    
    [self.imageOfTouXiang sd_setImageWithURL:[NSURL URLWithString:model.image] placeholderImage:[UIImage imageNamed:@"1f178a82b9014a90e9109296ad773912b31beeeb"]];
    self.labelOfCount.text = [NSString stringWithFormat:@"%@篇游记", model.trips_count];
    self.labelOfGuanZhu.text = @"+ 关注";
    self.labelOfSiXin.text = @"发私信";
    self.labelOfName.text = model.name;
    
}













@end
